#include "dialogchangepass.h"
#include "ui_changepassdialog.h"

#include <QDebug>
DialogChangePass::DialogChangePass(QWidget *parent) :
    MoveDialog(parent),
    ui(new Ui::ChangePassDialog)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint |
                   Qt::Tool | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
}
DialogChangePass::DialogChangePass(QWidget *parent,const QString &title) :
    MoveDialog(parent),
    ui(new Ui::ChangePassDialog)
{
    ui->setupUi(this);
    setWindowFlags(Qt::FramelessWindowHint |
                   Qt::Tool | Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
    ui->lb_title->setText(title);
    setTopHeight(ui->panel_aup->height());
}
DialogChangePass::~DialogChangePass()
{
    delete ui;
}

void DialogChangePass::on_bt_cancel_pressed()
{

   pressedAdjust();

}

void DialogChangePass::on_bt_cancel_clicked()
{
    this->hide();
}

void DialogChangePass::on_bt_ok_clicked()
{
    ui->lb_info->setText("");
    QString strPass = ui->ed_passwd->text().trimmed();
    if(strPass.length()<6){
        ui->lb_info->setText("密码必须大于等于六位数");
        return ;
    }
    QString confirm = ui->ed_confirm->text().trimmed();
    if(confirm !=strPass){
        ui->lb_info->setText("两次输入不匹配");
        return ;
    }
    emit setPasswdOk(strPass);
    this->hide();
}
